/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pracamagisterska;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Adrian
 */
public class PasswordRecoverInformation extends javax.swing.JInternalFrame {

    DatabaseThread db;
    int type;

    /**
     * Creates new form PasswordRecoverInformation
     */
    public PasswordRecoverInformation(DatabaseThread db, int type) {
        initComponents();
        this.db = db;
        this.type = type;
        switch (type) {
            case 1:
                jButton1.setText("     Zakończ     ");
                jLabel6.setText("<html><center>Gratulujemy!<br/> Twoje hasło zostało zmienione poprawnie</center></html>");
                jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/childish_thumb_up.png")));
                break;
            case 2:
                jButton1.setText("     Zakończ     ");
                jLabel6.setText("<html><center>Gratulujemy!<br/> Możesz korzystać z nowego loginu</center></html>");
                jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/childish_thumb_up.png")));
                break;
            case 3:
                jButton1.setText("     Zakończ     ");
                jLabel6.setText("<html><center>Wystapił błąd!<br/> Spróbuj ponownie później</center></html>");
                break;
            default:
                break;

        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/childish_thumb_down.png"))); // NOI18N
        jLabel1.setText("jLabel1");

        jLabel6.setFont(new java.awt.Font("Arial", 1, 13)); // NOI18N
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText("<html><center>Niestety podane dane nie są prawidłowe. <br/> Spróbuj ponownie.</center></html>");

        jButton1.setText("Spróbuj ponownie");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(119, 119, 119)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(118, 118, 118)
                .addComponent(jButton1)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31)
                .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton1)
                .addContainerGap(45, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (type != 0) {
            try {
                this.dispose();
                db.window2();
            } catch (SQLException ex) {
                Logger.getLogger(PasswordRecoverInformation.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else {
            PasswordRecover psw = new PasswordRecover(db);
            db.main.jDesktopPane2.add(psw);
            db.main.jDesktopPane2.selectFrame(true).setLocation(db.main.jDesktopPane2.getWidth() / 2 - psw.getWidth() / 2, 100);
            psw.setVisible(true);
            this.dispose();
        }
    }//GEN-LAST:event_jButton1ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    protected javax.swing.JLabel jLabel6;
    // End of variables declaration//GEN-END:variables
}
